using System;
using System.ComponentModel;
using System.Drawing;
using System.Drawing.Design;
using System.Drawing.Drawing2D;
using System.Security.Permissions;
using System.Web;
using PickGold.Charting.Utilities;
using PickGold.Charting.Design;

namespace PickGold.Charting
{
	[SRDescription("DescriptionAttributeRectangleAnnotation_RectangleAnnotation"), AspNetHostingPermission(SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal), AspNetHostingPermission(SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
	public class RectangleAnnotation : TextAnnotation
	{
		internal bool isRectVisible = true;

		internal override void Paint(Chart chart, ChartGraphics graphics)
		{
			PointF empty = PointF.Empty;
			PointF anchorLocation = PointF.Empty;
			SizeF size = SizeF.Empty;
			this.GetRelativePosition(out empty, out size, out anchorLocation);
			PointF tf3 = new PointF(empty.X + size.Width, empty.Y + size.Height);
			RectangleF ef2 = new RectangleF(empty, new SizeF(tf3.X - empty.X, tf3.Y - empty.Y));
			RectangleF rectF = new RectangleF(ef2.Location, ef2.Size);
			if (rectF.Width < 0f)
			{
				rectF.X = rectF.Right;
				rectF.Width = -rectF.Width;
			}
			if (rectF.Height < 0f)
			{
				rectF.Y = rectF.Bottom;
				rectF.Height = -rectF.Height;
			}
			if ((!float.IsNaN(rectF.X) && !float.IsNaN(rectF.Y)) && (!float.IsNaN(rectF.Right) && !float.IsNaN(rectF.Bottom)))
			{
				if (this.isRectVisible && base.Common.ProcessModePaint)
				{
					graphics.FillRectangleRel(rectF, this.BackColor, this.BackHatchStyle, string.Empty, ChartImageWrapMode.Scaled, Color.Empty, ChartImageAlignmentStyle.Center, this.BackGradientStyle, this.BackSecondaryColor, this.LineColor, this.LineWidth, this.LineDashStyle, this.ShadowColor, this.ShadowOffset, PenAlignment.Center, base.isEllipse, 1, false);
				}
				base.Paint(chart, graphics);
			}
		}

		[Browsable(false), SerializationVisibility(SerializationVisibility.Hidden), SRDescription("DescriptionAttributeAnnotationType"), SRCategory("CategoryAttributeMisc"), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden), Bindable(true), EditorBrowsable(EditorBrowsableState.Never)]
		public override string AnnotationType
		{
			get
			{
				return "Rectangle";
			}
		}

		[SRCategory("CategoryAttributeAppearance"), TypeConverter(typeof(ColorConverter)), Browsable(true), DefaultValue(typeof(Color), ""), SRDescription("DescriptionAttributeBackColor"), NotifyParentProperty(true), Editor(typeof(ChartColorEditor), typeof(UITypeEditor))]
		public override Color BackColor
		{
			get
			{
				return base.BackColor;
			}
			set
			{
				base.BackColor = value;
			}
		}

		[Editor(typeof(GradientEditor), typeof(UITypeEditor)), SRDescription("DescriptionAttributeBackGradientStyle"), SRCategory("CategoryAttributeAppearance"), Browsable(true), DefaultValue(0), NotifyParentProperty(true)]
		public override GradientStyle BackGradientStyle
		{
			get
			{
				return base.BackGradientStyle;
			}
			set
			{
				base.BackGradientStyle = value;
			}
		}

		[SRCategory("CategoryAttributeAppearance"), Editor(typeof(HatchStyleEditor), typeof(UITypeEditor)), Browsable(true), DefaultValue(0), NotifyParentProperty(true), SRDescription("DescriptionAttributeBackHatchStyle")]
		public override ChartHatchStyle BackHatchStyle
		{
			get
			{
				return base.BackHatchStyle;
			}
			set
			{
				base.BackHatchStyle = value;
			}
		}

		[Editor(typeof(ChartColorEditor), typeof(UITypeEditor)), TypeConverter(typeof(ColorConverter)), SRCategory("CategoryAttributeAppearance"), Browsable(true), DefaultValue(typeof(Color), ""), NotifyParentProperty(true), SRDescription("DescriptionAttributeBackSecondaryColor")]
		public override Color BackSecondaryColor
		{
			get
			{
				return base.BackSecondaryColor;
			}
			set
			{
				base.BackSecondaryColor = value;
			}
		}

		[DefaultValue(typeof(Color), "Black"), TypeConverter(typeof(ColorConverter)), Editor(typeof(ChartColorEditor), typeof(UITypeEditor)), Browsable(true), SRCategory("CategoryAttributeAppearance"), SRDescription("DescriptionAttributeLineColor")]
		public override Color LineColor
		{
			get
			{
				return base.LineColor;
			}
			set
			{
				base.LineColor = value;
			}
		}

		[DefaultValue(5), SRCategory("CategoryAttributeAppearance"), SRDescription("DescriptionAttributeLineDashStyle"), Browsable(true)]
		public override ChartDashStyle LineDashStyle
		{
			get
			{
				return base.LineDashStyle;
			}
			set
			{
				base.LineDashStyle = value;
			}
		}

		[SRDescription("DescriptionAttributeLineWidth"), DefaultValue(1), SRCategory("CategoryAttributeAppearance"), Browsable(true)]
		public override int LineWidth
		{
			get
			{
				return base.LineWidth;
			}
			set
			{
				base.LineWidth = value;
			}
		}

		[SerializationVisibility(SerializationVisibility.Hidden), SRDescription("DescriptionAttributeSelectionPointsStyle"), SRCategory("CategoryAttributeAppearance"), DefaultValue(1), ParenthesizePropertyName(true), Browsable(false), EditorBrowsable(EditorBrowsableState.Never), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
		internal override SelectionPointsStyle SelectionPointsStyle
		{
			get
			{
				return SelectionPointsStyle.Rectangle;
			}
		}
	}
}

